import {Page} from "@playwright/test";

export class LoginPage {
    private readonly page: Page;

    constructor(page: Page) {
        this.page = page;
    }

    async GPOOpen(address: string): Promise<void> {
        // 锁定http
        // self.page.set_extra_http_headers({'ignore-ssl-errors': 'true'})
        // print(address)
        await this.page.goto(address);
    }

    async enterUsername(username: string): Promise<void> {
        await this.page.fill('#username', username);
    }

    async enterPassword(password: string): Promise<void> {
        await this.page.fill('#password', password);
    }

    async clickLoginButton(): Promise<void> {
        await this.page.click('#loginIn');
    }

    async singleSignOn(): Promise<void> {
        await this.page.getByText('当前电脑用户直接登录').click();
    }
}
